<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">CERROR</b>
<td valign="baseline" align="right" class="function"><a href="../misc/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Computes classification error.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;=&nbsp;cerror(ypred,ytrue)</span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;=&nbsp;cerror(ypred,ytrue,label)&nbsp;</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;=&nbsp;cerror(ypred,ytrue)&nbsp;returns&nbsp;classification&nbsp;error,&nbsp;i.e.,</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error=&nbsp;&nbsp;find(ypred~=ytrue)/length(ytrue).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;=&nbsp;cerror(ypred,ytrue,label)&nbsp;considers&nbsp;only&nbsp;labels</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;find(ytrue==label),&nbsp;i.e.,&nbsp;if&nbsp;ypred,&nbsp;ytrue&nbsp;are&nbsp;from&nbsp;{1,2}&nbsp;then</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;&nbsp;false_positives_rate&nbsp;=&nbsp;cerror(ypred,ytrue,2)</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;false_negatives_rate&nbsp;=&nbsp;cerror(ypred,ytrue,1)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;y1&nbsp;[1&nbsp;x&nbsp;n]&nbsp;Vector&nbsp;of&nbsp;integers&nbsp;(response&nbsp;of&nbsp;classifier).</span><br>
<span class=help>&nbsp;&nbsp;y2&nbsp;[1&nbsp;x&nbsp;n]&nbsp;Vector&nbsp;of&nbsp;integers&nbsp;(ground&nbsp;truth).</span><br>
<span class=help>&nbsp;&nbsp;label&nbsp;[int]&nbsp;Selected&nbsp;label.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;[real]&nbsp;Error.&nbsp;</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;classifier&nbsp;&nbsp;=&nbsp;[1,1,1,2]</span><br>
<span class=help>&nbsp;&nbsp;groundtruth&nbsp;=&nbsp;[2,1,2,1]</span><br>
<span class=help>&nbsp;&nbsp;error&nbsp;=&nbsp;cerror(classifier,groundtruth)</span><br>
<span class=help>&nbsp;&nbsp;false_pos&nbsp;=&nbsp;cerror(classifier,groundtruth,2)</span><br>
<span class=help>&nbsp;&nbsp;false_neg&nbsp;=&nbsp;cerror(classifier,groundtruth,1)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../misc/roc.html" target="mdsbody">ROC</a></span><br>
<span class=help><span class=also></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../misc/list/cerror.html">cerror.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 08-aug-2005, VF<br>
 09-jun-2004, VF<br>
 14-Jan-2003, VF<br>

</body>
</html>
